<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<div class="row">
	<div class="col-lg-10 offset-lg-1">
		<div class="card">
		<div class="card-body">
			<form action="<?php echo url("plugin-setting-sg_group");?>" method="post" id="form">
				<h4 class="card-title"><?php echo lang('sg_group_setting');?></h4>
				<div class="form-group row">
					<label class="col-sm-2 form-control-label"><?php echo lang('sg_up_group');?>：</label>
					<div class="col-sm-3">
						<?php echo $input['up_group']; ?>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-2 form-control-label"><?php echo lang('sg_isfirst');?>：</label>
					<div class="col-sm-3">
						<?php echo $input['isfirst']; ?>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-2 form-control-label"><?php echo lang('sg_isfirst_credits');?>：</label>
					<div class="col-10 input-group">
						<div class="input-group-prepend">
							<span class="input-group-text"><?php echo lang('sg_credits');?></span>
						</div>
						<?php echo $input['creditsfrom']; ?><span class="m-2 input-group-prepend">-</span>
						<?php echo $input['creditsto']; ?>
					</div>
				</div>
				<div class="form-group row">
					<label class="col-sm-2 form-control-label"></label>
					<div class="col-10 input-group">
						<div class="input-group-prepend">
							<span class="input-group-text"><?php echo lang('sg_golds');?></span>
						</div>
						<?php echo $input['goldsfrom']; ?><span class="m-2 input-group-prepend">-</span>
						<?php echo $input['goldsto']; ?>
					</div>
				</div>
				
				<div class="table-responsive arrlist">
					<table class="table" style="min-width: 800px"><hr>
						<thead>
							<tr align="center">
								<th width="80"><?php echo lang('sg_forum_name');?></th>
								<th width="80"><?php echo lang('sg_create_reward');?></th>
								<th width="80"><?php echo lang('sg_post_reward');?></th>
							</tr>
						<thead>
						<tbody>
							<?php foreach($forumlist as $_fid=>$_forum) { ?>
							<tr align="center">
							<input type="hidden" name="fid[<?php echo $_fid;?>]" value="<?php echo $_forum['fid']; ?>" />
								<td class="50"><?php echo $_forum['name']; ?></td>
								<td>
									<div class="col-sm-12 form-group row">
										<div class="col-6 input-group">
											<div class="input-group-prepend">
												<span class="input-group-text"><?php echo lang('sg_credits');?></span>
											</div>
											<input type="text" class="form-control" name="create_credits[<?php echo $_fid;?>]" value="<?php echo $_forum['create_credits']; ?>" />
										</div>
										<div class="col-6 input-group">
											<div class="input-group-prepend">
												<span class="input-group-text"><?php echo lang('sg_golds');?></span>
											</div>
											<input type="text" class="form-control" name="create_golds[<?php echo $_fid;?>]" value="<?php echo $_forum['create_golds']; ?>" />
										</div>
									</div>
								</td>
								<td>
									<div class="col-sm-12 form-group row">
										<div class="col-6 input-group">
											<div class="input-group-prepend">
												<span class="input-group-text"><?php echo lang('sg_credits');?></span>
											</div>
											<input type="text" class="form-control" name="post_credits[<?php echo $_fid;?>]" value="<?php echo $_forum['post_credits']; ?>" />
										</div>
										<div class="col-6 input-group">
											<div class="input-group-prepend">
												<span class="input-group-text"><?php echo lang('sg_golds');?></span>
											</div>
											<input type="text" class="form-control" name="post_golds[<?php echo $_fid;?>]" value="<?php echo $_forum['post_golds']; ?>" />
										</div>
									</div>
								</td>
							</tr>
							<?php } ?>
						</tbody>
					</table>
				</div>
				<div class="form-group row">
					<label class="col-sm-2 form-control-label"></label>
					<div class="col-sm-10">
						<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>..."><?php echo lang('confirm');?></button>
						<a role="button" class="btn btn-secondary btn-block mt-1" href="javascript:history.back();"><?php echo lang('back');?></a>
					</div>
				</div>
			</form>
			<p class="text-small text-muted">用户组升级增强版 插件为<a target='_blank' href='http://cha.sgahz.net/'>查鸽信息网</a>制作。 联系QQ：5886425</p>
		</div>
		</div>
	</div>
</div>

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>

var jform = $("#form");
var jsubmit = $("#submit");
var referer = '<?php echo url("plugin-setting-sg_group");?>';
jform.on('submit', function(){
	jform.reset();
	jsubmit.button('loading');
	var postdata = jform.serialize();
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.text(message).delay(2000).button('reset').location(referer);
			return;
		} else {
			$.alert(message);
			jsubmit.button('reset');
		}
	});
	return false;
});

</script>